Attach and detach ENIs using the AWS Management Console, AWS CLI, or AWS SDKs, with the ability to attach ENIs to running or stopped EC2 instances depending on the instance type and the ENI being primary or secondary.
You can attach additional ENIs to an EC2 instance during launch or while the instance is running (hot attach) for supported instance types. The primary ENI (eth0) is attached at launch and cannot be detached. Secondary ENIs can be attached to running instances of most current-generation instance types, or to stopped instances for all instance types. Detaching an ENI removes it from the instance but preserves the ENI configuration, allowing you to attach it to another instance later.
The primary network interface (eth0) cannot be detached from an instance
You cannot attach an ENI to an instance in a different Availability Zone
An ENI can only be attached to one instance at a time
Some older instance types require the instance to be stopped before attaching/detaching ENIs
Nitro-based instances support hot attach/detach of ENIs while the instance is running
An instance can have multiple ENIs, but the maximum number varies by instance type (from 2 to 15+ secondary ENIs)
When attaching an ENI, the device index must be unique and sequential
After attaching, you may need to configure the OS to recognize the new network interface (e.g., using dhclient or creating network config files)
When you attach a secondary ENI to a running instance, the operating system may not automatically detect and configure the new interface. For Linux instances, you typically need to run sudo dhclient ethN (where N is the device index) or configure the interface permanently in /etc/network/interfaces or /etc/sysconfig/network-scripts/. For Windows instances, the new interface should be detected automatically, but you may need to enable it in the Network Connections control panel.